Skip to content

Use ZEND_UNREACHABLE() instead of ZEND_ASSERT(0) #5726

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Jun 16, 2020

Instead of marking unreachable code with ZEND_ASSERT(0), we introduce
ZEND_UNREACHABLE(), so that MSVC which does not consider assert(0)
to mark unreachable code does no longer trigger C4715[1] warnings in
debug builds. This may be useful for other compilers as well.

[1] https://docs.microsoft.com/de-de/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4715?view=vs-2019

Instead of marking unreachable code with `ZEND_ASSERT(0)`, we introduce
`ZEND_UNREACHABLE()`, so that MSVC which does not consider `assert(0)`
to mark unreachable code does no longer trigger C4715[1] warnings in
debug builds.  This may be useful for other compilers as well.

[1] <https://docs.microsoft.com/de-de/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4715?view=vs-2019>
@cmb69
Copy link
Member Author

cmb69 commented Jun 16, 2020

Thanks! Applied as 92c4b06.

@cmb69 cmb69 closed this Jun 16, 2020
@cmb69 cmb69 deleted the cmb/fix-c4715 branch June 16, 2020 16:40
@carusogabriel carusogabriel added this to the PHP 8.0 milestone Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants